<?php
	$path_one = 'admin/admin_system';
	$path_two = 'admin/boss';
	$filename = 'admin/boss_edit';
	require_once("header.php");
	require_once("admin_comm.php");
	$boss_object=new boss();
	$id= request('id',false,true);
	
	$result=$boss_object->admin_boss_info($id);
?>
<script type="text/javascript" charset="utf-8">
	loader.file({
		plugin:['validform/main','dialog/main'],
		js:['city_area', 'html'],
		skincss:['list']
	});
	$(document).ready(function(){

		var form_obj=$("#form1").Validform({
		   tiptype: function(msg, o, cssctl){
			   if(!o.obj.is("form")){
				   var obj = o.obj.parent("td").find('tt');
				   cssctl(obj, o.type);
				   obj.text(msg);
			   }
		   },
		   datatype:{
			   "syj1-100": /^[\w-]{1,100}$/
		   },
		   postonce:true

		})
	})

</script>
</head>
<body>
	<div class="position_nav">你所在的当前位置：<?php echo $path_str;?> &gt; <?php echo $result['id']?'编辑管理员':'添加管理员' ;?></div>
		<div class="main">
			<form action="/handle.php" method="post" id='form1'>
			<input type="hidden" name="h" value="boss/admin_edit">
			<input type="hidden" name="id" value="<?php echo $result['id']?>">
			<table  cellpadding="0" cellspacing="1" border="0" class="table table_text">
			    <?php 
			       if($result){
			    ?>
				<tr>
					<td class="left">设备老板帐号：</td>
					<td><strong><?php echo $result['account'] ;?></strong></td>
				</tr>	
				<tr>
					<td class="left">注册时间：</td>
					<td><?php echo date('Y-m-d H:i:s',$result['time']);?></td>
				</tr>						
				<?php 
				  }else{
				?>
				<tr>
					<td class="left">设备老板帐号：</td>
					<td>
						<input type="text" class='client_id w260' id='client_id' name='account' value="<?php echo $result['account'] ;?>" datatype='syj1-20' errormsg='管理员帐号字符在1-10字以内,数字、字母、下划线、-' nullmsg='请输入管理员帐号' <?php echo !$result['id']?' ajaxurl="/handle.php?h=boss/boss_unique"':'' ;?>><span class='comment'>管理员帐号字符在1-20字以内,数字、字母、下划线、-</span><tt></tt>
					</td>
				</tr>
				<?php 
				  }
				?>
				<tr>
					<td class="left">设备老板名称：</td>
					<td>
						<input type="text" class="w260" name='name' value="<?php echo $result['name'] ;?>" datatype='*1-10' errormsg='字符在1-10内' nullmsg='请输入管理员名称'><span class='comment'></span><tt></tt>

					</td>
				</tr>
				<tr>
					<td class="left">密码：</td>
					<td>
						<input type="password" class="w260" name='password' <?php echo $result['id']?'ignore="ignore"':'' ;?> value="" datatype='*6-20' nullmsg='请填写密码！' errormsg='密码字符在6-20以内'><?php echo $result['id']?'<span class="comment">修改时不输入密码表示不修改密码</span>':'' ;?><tt></tt>
					</td>
				</tr>
				<tr>
					<td class="left">确认密码：</td>
					<td>
						<input type="password" class="w260" name='repassword' value="" datatype='*6-20' errormsg="两次输入的密码不一致！" recheck="password" nullmsg="请填写密码！" <?php echo $result['id']?'ignore="ignore"':'' ;?>><?php echo $result['id']?'<span class="comment">修改时不输入密码表示不修改密码</span>':'' ;?><tt></tt>
					</td>
				</tr>
				<tr>
					<td class="left">状态：</td>
					<td>
						<input type="radio" class="noborder" name='state' id='r1' value="1"<?php echo $result['state']==1||!isset($result['state'])?' checked ':'' ;?>><label for='r1'>启用</label>
						<input type="radio" name='state' id='r2' class="noborder" value="0" datatype="n" nullmsg="请选择管理员状态" errormsg="请选择管理员状态" <?php echo $result['state']==0 && isset($result['state'])?' checked ':'' ;?>><label for='r2'>禁用</label>
						<tt></tt>
					</td>
				</tr>

				<tr>
					<td class="left">联系电话：</td>
					<td>
						<input type="text" class="w260" ignore="ignore" name='phone' value="<?php echo $result['phone'] ;?>" datatype='m' errormsg='请输入正确的手机号码' nullmsg='请输入联系电话'><span class='comment'></span><tt></tt>

					</td>
				</tr>
				<tr>
					<td class="left">邮箱：</td>
					<td>
						<input type="text" class="w260" ignore="ignore" name='email' value="<?php echo $result['email'] ;?>" datatype='e' errormsg='邮箱格式不正确' nullmsg='请输入邮箱'><span class='comment'></span><tt></tt>

					</td>
				</tr>
				<tr>
					<td class="left">性别：</td>
					<td>
						<input type="radio" class="noborder" name='sex' id='r3' value="1"<?php echo $result['sex']==1||!isset($result['sex'])?' checked ':'' ;?>><label for='r1'>女</label>
						<input type="radio" class="noborder" name='sex' id='r4' value="0" datatype="n" nullmsg="请选择性别" errormsg="请选择性别" <?php echo $result['sex']==0 && isset($result['sex'])?' checked ':'' ;?>><label for='r2'>男</label>

					</td>
				</tr>

				<tr>
					<td></td>
					<td>
						<input class="button1" type="submit" value="<?php echo $result['id']?'编辑':'添加' ;?>">
					</td>
				</tr>

			</table>
			</form>
		</div>
	</div>
</body>
</html>